﻿#include "dialog.h"
#include "ui_dialog.h"
#include <QDebug>
Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);
    m_thread = new JoystickThread(this);
    connect(m_thread, SIGNAL(Joy_MoveLeft()), this, SLOT(MoveLeft()));
    connect(m_thread, SIGNAL(Joy_MoveLeftStop()), this, SLOT(MoveLeftStop()));
    connect(m_thread, SIGNAL(Joy_MoveRight()), this, SLOT(MoveRight()));
    connect(m_thread, SIGNAL(Joy_MoveRightStop()), this, SLOT(MoveRightStop()));
    connect(m_thread, SIGNAL(Joy_MoveBackward()), this, SLOT(MoveBackward()));
    connect(m_thread, SIGNAL(Joy_MoveBackwardStop()), this, SLOT(MoveBackwardStop()));
    connect(m_thread, SIGNAL(Joy_MoveForward()), this, SLOT(MoveForward()));
    connect(m_thread, SIGNAL(Joy_MoveForwardStop()), this, SLOT(MoveForwardStop()));

    connect(m_thread, SIGNAL(Joy_MoveClockWise()), this, SLOT(MoveDown()));
    connect(m_thread, SIGNAL(Joy_MoveClockWiseStop()), this, SLOT(MoveDownStop()));
    connect(m_thread, SIGNAL(Joy_MoveCCW()), this, SLOT(MoveUp()));
    connect(m_thread, SIGNAL(Joy_MoveCCWStop()), this, SLOT(MoveUpStop()));

    m_thread->enableSignal(true);
    m_thread->enableButtionSignal(true);
    m_thread->enableXYSignal(true);
    m_thread->enableZSignal(true);
    m_thread->start();
}
void Dialog::MoveLeft()
{
    qDebug() << "MoveLeft()";
}

void Dialog::MoveLeftStop()
{
    qDebug() << "MoveLeftStop()";
}

void Dialog::MoveRight()
{
    qDebug() << "MoveRight()";
}

void Dialog::MoveRightStop()
{
 qDebug() << "MoveRightStop()";
}

void Dialog::MoveUp()
{
    qDebug() << "MoveUp()";
}

void Dialog::MoveUpStop()
{
    qDebug() << "MoveUpStop()";
}

void Dialog::MoveDown()
{
    qDebug() << "MoveDown()";
}

void Dialog::MoveDownStop()
{
    qDebug() << "MoveDownStop()";
}


void Dialog::MoveForward()
{
    qDebug() << "MoveForward()";
}

void Dialog::MoveForwardStop()
{
    qDebug() << "MoveForwardStop()";
}

void Dialog::MoveBackward()
{
    qDebug() << "MoveBackward()";
}

void Dialog::MoveBackwardStop()
{
    qDebug() << "MoveBackwardStop()";
}

Dialog::~Dialog()
{
    m_thread->stop();
    delete ui;
}
